package com.imooc.infra.repository.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.imooc.infra.repository.entity.TDataCenterCollect;
import com.imooc.infra.repository.mapper.TDataCenterCollectMapper;
import com.imooc.infra.repository.service.ITDataCenterCollectService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 18870
 * @since 2023-05-27
 */
@Service
public class TDataCenterCollectServiceImpl extends ServiceImpl<TDataCenterCollectMapper, TDataCenterCollect> implements ITDataCenterCollectService {

    @Override
    public List<TDataCenterCollect> listByRuleId(Long ruleId) {
        LambdaQueryWrapper<TDataCenterCollect> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TDataCenterCollect::getRuleId, ruleId);
        return this.list(wrapper);
    }

    @Override
    public TDataCenterCollect getByRuleIdAndEnName(Long ruleId, String enName) {
        LambdaQueryWrapper<TDataCenterCollect> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TDataCenterCollect::getRuleId, ruleId);
        wrapper.eq(TDataCenterCollect::getEnName, enName);
        return this.getOne(wrapper);
    }
}
